const appTitle = import.meta.env.VITE_GLOB_APP_TITLE

export default function createTitleGuard(router) {
  router.afterEach((to) => {
    const pageTitle = to.meta?.title
    document.title = pageTitle ? `${pageTitle} | ${appTitle}` : appTitle
  })
}
